/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package smartgrid;

import org.orm.*;
import org.hibernate.Query;
import java.util.List;

import java.io.Serializable;
public class VariaveisSistema implements Serializable {
	public VariaveisSistema() {
	}
	
	public static VariaveisSistema loadVariaveisSistemaByORMID(int ID) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return loadVariaveisSistemaByORMID(session, ID);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema getVariaveisSistemaByORMID(int ID) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return getVariaveisSistemaByORMID(session, ID);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByORMID(int ID, org.hibernate.LockMode lockMode) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return loadVariaveisSistemaByORMID(session, ID, lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema getVariaveisSistemaByORMID(int ID, org.hibernate.LockMode lockMode) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return getVariaveisSistemaByORMID(session, ID, lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByORMID(PersistentSession session, int ID) {
		try {
			return (VariaveisSistema) session.load(smartgrid.VariaveisSistema.class, new Integer(ID));
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema getVariaveisSistemaByORMID(PersistentSession session, int ID) {
		try {
			return (VariaveisSistema) session.get(smartgrid.VariaveisSistema.class, new Integer(ID));
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) {
		try {
			return (VariaveisSistema) session.load(smartgrid.VariaveisSistema.class, new Integer(ID), lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema getVariaveisSistemaByORMID(PersistentSession session, int ID, org.hibernate.LockMode lockMode) {
		try {
			return (VariaveisSistema) session.get(smartgrid.VariaveisSistema.class, new Integer(ID), lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema[] listVariaveisSistemaByQuery(String condition, String orderBy) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return listVariaveisSistemaByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema[] listVariaveisSistemaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return listVariaveisSistemaByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema[] listVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy) {
		StringBuffer sb = new StringBuffer("From smartgrid.VariaveisSistema as VariaveisSistema");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			List list = query.list();
			return (VariaveisSistema[]) list.toArray(new VariaveisSistema[list.size()]);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema[] listVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) {
		StringBuffer sb = new StringBuffer("From smartgrid.VariaveisSistema as VariaveisSistema");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			query.setLockMode("this", lockMode);
			List list = query.list();
			return (VariaveisSistema[]) list.toArray(new VariaveisSistema[list.size()]);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByQuery(String condition, String orderBy) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return loadVariaveisSistemaByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return loadVariaveisSistemaByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy) {
		VariaveisSistema[] variaveisSistemas = listVariaveisSistemaByQuery(session, condition, orderBy);
		if (variaveisSistemas != null && variaveisSistemas.length > 0)
			return variaveisSistemas[0];
		else
			return null;
	}
	
	public static VariaveisSistema loadVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) {
		VariaveisSistema[] variaveisSistemas = listVariaveisSistemaByQuery(session, condition, orderBy, lockMode);
		if (variaveisSistemas != null && variaveisSistemas.length > 0)
			return variaveisSistemas[0];
		else
			return null;
	}
	
	public static java.util.Iterator iterateVariaveisSistemaByQuery(String condition, String orderBy) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return iterateVariaveisSistemaByQuery(session, condition, orderBy);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static java.util.Iterator iterateVariaveisSistemaByQuery(String condition, String orderBy, org.hibernate.LockMode lockMode) {
		try {
			PersistentSession session = smartgrid.SmartgridPersistentManager.instance().getSession();
			return iterateVariaveisSistemaByQuery(session, condition, orderBy, lockMode);
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static java.util.Iterator iterateVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy) {
		StringBuffer sb = new StringBuffer("From smartgrid.VariaveisSistema as VariaveisSistema");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			return query.iterate();
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static java.util.Iterator iterateVariaveisSistemaByQuery(PersistentSession session, String condition, String orderBy, org.hibernate.LockMode lockMode) {
		StringBuffer sb = new StringBuffer("From smartgrid.VariaveisSistema as VariaveisSistema");
		if (condition != null)
			sb.append(" Where ").append(condition);
		if (orderBy != null)
			sb.append(" Order By ").append(orderBy);
		try {
			Query query = session.createQuery(sb.toString());
			query.setLockMode("this", lockMode);
			return query.iterate();
		}
		catch (Exception e) {
			return null;
		}
	}
	
	public static VariaveisSistema loadVariaveisSistemaByCriteria(VariaveisSistemaCriteria variaveisSistemaCriteria) {
		VariaveisSistema[] variaveisSistemas = listVariaveisSistemaByCriteria(variaveisSistemaCriteria);
		if(variaveisSistemas == null || variaveisSistemas.length == 0) {
			return null;
		}
		return variaveisSistemas[0];
	}
	
	public static VariaveisSistema[] listVariaveisSistemaByCriteria(VariaveisSistemaCriteria variaveisSistemaCriteria) {
		return variaveisSistemaCriteria.listVariaveisSistema();
	}
	
	public static VariaveisSistema createVariaveisSistema() {
		return new smartgrid.VariaveisSistema();
	}
	
	public boolean save() {
		try {
			smartgrid.SmartgridPersistentManager.instance().saveObject(this);
			return true;
		}
		catch (Exception e) {
			return false;
		}
	}
	
	public boolean delete() {
		try {
			smartgrid.SmartgridPersistentManager.instance().deleteObject(this);
			return true;
		}
		catch (Exception e) {
			return false;
		}
	}
	
	public boolean refresh() {
		try {
			smartgrid.SmartgridPersistentManager.instance().getSession().refresh(this);
			return true;
		}
		catch (Exception e) {
			return false;
		}
	}
	
	public boolean evict() {
		try {
			smartgrid.SmartgridPersistentManager.instance().getSession().evict(this);
			return true;
		}
		catch (Exception e) {
			return false;
		}
	}
	
	private int ID;
	
	private java.util.Date ultimoPovDia;
	
	private java.util.Date ultimoPovSemana;
	
	private java.util.Date ultimoPovMes;
	
	private void setID(int value) {
		this.ID = value;
	}
	
	public int getID() {
		return ID;
	}
	
	public int getORMID() {
		return getID();
	}
	
	public void setUltimoPovDia(java.util.Date value) {
		this.ultimoPovDia = value;
	}
	
	public java.util.Date getUltimoPovDia() {
		return ultimoPovDia;
	}
	
	public void setUltimoPovSemana(java.util.Date value) {
		this.ultimoPovSemana = value;
	}
	
	public java.util.Date getUltimoPovSemana() {
		return ultimoPovSemana;
	}
	
	public void setUltimoPovMes(java.util.Date value) {
		this.ultimoPovMes = value;
	}
	
	public java.util.Date getUltimoPovMes() {
		return ultimoPovMes;
	}
	
	public String toString() {
		return String.valueOf(getID());
	}
	
}
